package com.seecen.HJM.controller;

import com.seecen.HJM.model.dto.PlaylistDTO;
import com.seecen.HJM.model.dto.PlaylistGetSongDto;
import com.seecen.HJM.model.entity.Song;
import com.seecen.HJM.model.vo.PlayListVo;
import com.seecen.HJM.model.vo.PlaylistDetailVO;
import com.seecen.HJM.result.DataVo;
import com.seecen.HJM.result.PageResult;
import com.seecen.HJM.service.PlaylistService;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/playlist")
public class PlaylistController {
    @Autowired
    private PlaylistService playlistService;

    //获取所有歌单
    @PostMapping("/getAllPlayLists")
    public DataVo<PageResult<PlayListVo>> getAllPlayLists(@RequestBody @Valid PlaylistDTO playlistDTO) {
        return playlistService.getAllPlayLists(playlistDTO);
    }


    //获取推荐歌单
    @GetMapping("/getRecommendedPlaylists")
    public DataVo<List<PlayListVo>> getRecommendedPlaylists(HttpServletRequest request) {
        return playlistService.getRecommendedPlaylists(request);
    }

    //获取歌单详细
    @GetMapping("/getPlaylistDetail/{id}")
    public DataVo<PlaylistDetailVO> getPlaylistDetail(@PathVariable("id") Long playlistId, HttpServletRequest request) {
        return playlistService.getPlaylistDetail(playlistId, request);
    }

}
